package com.shenmazong.controller;


import com.shenmazong.entity.TbCollect;
import com.shenmazong.service.TbCollectService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 用户收藏文章表 ——> John 前端控制器
 * </p>
 *
 * @author 还怕大雨吗
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/tbCollect")
@CrossOrigin
public class TbCollectController {

    
    @Resource
    private TbCollectService tbCollectService;

    /***
     * @description 查询某个用户的收藏，根据个人id
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:56
     */
    @PostMapping("/selectCollect")
    public ResultResponse selectCollect(@RequestBody ListParamVo listParamVo){
        return tbCollectService.selectCollect(listParamVo);
    }

    /**
     * @description 添加文章到我的收藏
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:56
     */
    @PostMapping("/insertCollect")
    public ResultResponse insertCollect(@RequestBody TbCollect tbCollect){
        return tbCollectService.insertCollect(tbCollect);
    }

    /***
     * @description 从我的收藏里删除某一个
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:57
     */
    @PostMapping("/deleteCollect")
    public ResultResponse deleteCollect(Long collectID){
        return tbCollectService.deleteCollect(collectID);
    }

    /***
     * @description 修改我的收藏
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 13:58
     */
    @PostMapping("/updateCollect")
    public ResultResponse updateCollect(@RequestBody TbCollect tbCollect){
        return tbCollectService.updateCollect(tbCollect);
    }


}

